<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>

<head>
    <%@include file="../system/head.jsp"%>
    <title>我的订单</title>

    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/css/webbase.css" />
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/css/pages-seckillOrder.css" />
</head>
<body>
<!-- 头部栏位 -->
<!--页面顶部-->
<%@include file="../system/header.jsp"%>

<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/plugins/jquery/jquery.min.js"></script>
<script type="text/javascript">
    $(function(){
        $("#service").hover(function(){
            $(".service").show();
        },function(){
            $(".service").hide();
        });
        $("#shopcar").hover(function(){
            $("#shopcarlist").show();
        },function(){
            $("#shopcarlist").hide();
        });

    })
</script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/plugins/jquery.easing/jquery.easing.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/plugins/sui/sui.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/plugins/jquery-placeholder/jquery.placeholder.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/widget/nav.js"></script>
<script>
    $(function () {
        var username = '${Username}';
        if(username === ''){
            $("#showUsername").html("请<a href=\"${pageContext.request.contextPath}/system/login\">登录</a>\n" +
                "                            <span><a href=\"${pageContext.request.contextPath}/system/register\">免费注册</a></span>")
        }else{
            $("#showUsername").html(""+username+" <a href='${pageContext.request.contextPath}/login/logout'>退出登录</a>");
        }

    });
</script>
</body>
<!--header-->
<div id="account">
    <div class="py-container">
        <div class="yui3-g home">
            <!--左侧列表-->
            <div class="yui3-u-1-6 list">
                <div class="list-items">
                    <dl>
                        <dt><i>·</i> 订单中心</dt>
                        <dd ><a href="${pageContext.request.contextPath}/system/toHome?username=${Username}&currentPage=1"  class="list-active" >我的订单</a></dd>
                        <dd><a href="${pageContext.request.contextPath}/system/toOrderList?username=${Username}&order_status=0&currentPage=1" >待付款</a></dd>
                        <dd><a href="${pageContext.request.contextPath}/system/toOrderList?username=${Username}&order_status=1&currentPage=1"  >待发货</a></dd>
                        <dd><a href="${pageContext.request.contextPath}/system/toOrderList?username=${Username}&order_status=2&currentPage=1" >待收货</a></dd>
                    </dl>
                    <dl>
                        <dt><i>·</i> 我的中心</dt>
                        <dd><a href="${pageContext.request.contextPath}/goods/toCollect?username=${Username}&currentPage=1">我的收藏</a></dd>
                    </dl>
                    <dl>
                        <dt><i>·</i> 设置</dt>
                        <dd><a href="${pageContext.request.contextPath}/system/toAddress?username=${Username}"  >地址管理</a></dd>
                    </dl>
                </div>
            </div>
            <!--右侧主内容-->
            <div class="yui3-u-5-6 order-pay">
                <div class="body">
                    <div class="table-title">
                        <table class="sui-table  order-table">
                            <tr>
                                <thead>
                                <th width="35%">宝贝</th>
                                <th width="5%">单价</th>
                                <th width="5%">数量</th>
                                <th width="8%">商品操作</th>
                                <th width="10%">实付款</th>
                                <th width="10%">交易状态</th>
                                <th width="10%">交易操作</th>
                                </thead>
                            </tr>
                        </table>
                    </div>
                    <div class="order-detail">
                        <c:forEach items="${page.list}" var="order">
                        <div class="orders">
                            <!--order1-->
                            <div class="choose-title">
                                <label>
                                    <span>　创建日期：${order.orders.get(0).create_time}　订单编号：${order.order_num} </span>
                                </label>
                                <a href="${pageContext.request.contextPath}/system/toOrderDetail?orderNum=${order.order_num}" style="margin-left: 450px">查看详情</a>
                            </div>
                            <table class="sui-table table-bordered order-datatable">
                                <tbody>
                                <!-- 开始二级遍历 -->
                                <c:forEach items="${order.orders}" var="item">
                                <tr>
                                    <td width="35%">
                                        <div class="typographic"><img width="20%" src="${item.goods.image1}" />
                                            <a href="${pageContext.request.contextPath}/goods/goodsDetail?goods_id=${item.goods.goods_id}" class="block-text">${item.goods.goods_name}</a>
                                            <span class="guige"></span>
                                        </div>
                                    </td>
                                    <td width="5%" class="center">
                                        <ul class="unstyled">
                                            <li>${item.goods.goods_price}</li>
                                        </ul>
                                    </td>
                                    <td width="5%" class="center">${item.buy_counts}</td>
                                    <td width="8%" class="center">
                                        <a href="${pageContext.request.contextPath}/goods/goodsDetail?goods_id=${item.goods.goods_id}" class="">再次购买</a><br>
                                        <a href="${pageContext.request.contextPath}/pay/deleteOrder?username=${Username}&currentPage=${page.currentPage}&order_id=${item.id}" class="delete">删除订单<input class="id" hidden value="${item.id}"></a>
                                    </td>
                                    <td width="10%" class="center" >
                                        <ul class="unstyled">
                                            <li>${item.paid_amount}</li>
                                            <li>（含运费：￥0.00）</li>
                                        </ul>
                                    </td>
                                    <td width="10%" class="center">
                                        <c:if test="${item.order_status == 0}">
                                        <ul class="unstyled">
                                            <li>等待付款</li>
                                        </ul>
                                        </c:if>
                                        <c:if test="${item.order_status == 1}" >
                                            <ul class="unstyled">
                                                <li>待发货</li>
                                            </ul>
                                        </c:if>
                                        <c:if test="${item.order_status == 2}">
                                            <ul class="unstyled">
                                                <li>待收货</li>
                                            </ul>
                                        </c:if>
                                        <c:if test="${item.order_status == 3}">
                                            <ul class="unstyled">
                                                <li>已完成</li>
                                            </ul>
                                        </c:if>
                                    </td>
                                    <td width="10%" class="center">
                                        <c:if test="${item.order_status == 0}">
                                            <ul class="unstyled">
                                                <li><a href="${pageContext.request.contextPath}/pay/toPay?orderNum=${item.order_num}&totalPrice=${item.order_amount}&subject=&addressId=${item.address.address_id}&username=${Username}" class="sui-btn btn-info pay">立即支付</a></li>
                                            </ul>
                                        </c:if>
                                        <c:if test="${item.order_status == 1}" >
                                            <ul class="unstyled">
                                                <li><a href="#" class="sui-btn btn-info send">提醒发货</a></li>
                                            </ul>
                                        </c:if>
                                        <c:if test="${item.order_status == 2}">
                                            <ul class="unstyled">
                                                <li><a href="#" class="sui-btn btn-info receive">确认收货</a></li>
                                            </ul>
                                        </c:if>
                                        <c:if test="${item.order_status == 3}">
                                            <ul class="unstyled">
                                                <li><a href="${pageContext.request.contextPath}/system/toDeveloping" class="sui-btn btn-info">去评价</a></li>
                                            </ul>
                                        </c:if>
                                    </td>
                                </tr>
                                </c:forEach>
                                </tbody>
                            </table>
                        </div>
                        </c:forEach>
                        <div class="choose-order">
                            <%--分页开始--%>
                                <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/css/page.css">
                                <script src="${pageContext.request.contextPath}/static/js/jquery.z-pager.js" type="text/javascript" charset="utf-8"></script>
                                <div id="pager" class="pager clearfix" style="float: right">
                                </div>
                                <script type="text/javascript">
                                    $("#pager").zPager({
                                        totalData: ${page.totalCount},
                                        current: ${page.currentPage},
                                        pageCount: ${page.totalPage}, //总页数
                                        pageData: ${page.pageSizes},
                                        minPage: 1,
                                        prevBtn: 'pg-prev', //上一页按钮
                                        nextBtn: 'pg-next', //下一页按钮
                                        btnShow: true,
                                        ajaxSetData: false
                                    });

                                    function currentPage(currentPage){
                                        /*
                                            触发页码数位置： Page/js/jquery.z-pager.js 64行
                                        */
                                        console.log("当前页码数：" + currentPage);
                                        if(currentPage !== ${page.currentPage}){
                                            location.href = "${pageContext.request.contextPath}/system/toHome?username=${Username}&currentPage="+currentPage+"";
                                        }
                                    }
                                </script>
                            <%--分页结束--%>
                        </div>
                        <div class="clearfix"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 底部栏位 -->
<!--页面底部-->
<%@include file="../system/Footer.jsp"%>
<!--页面底部END-->
    <!-- 楼层位置 -->

    <script type="text/javascript">
        $(function(){
            $("#service").hover(function(){
                $(".service").show();
            },function(){
                $(".service").hide();
            });
            $("#shopcar").hover(function(){
                $("#shopcarlist").show();
            },function(){
                $("#shopcarlist").hide();
            });

        })
    </script>
<script>
    $(function () {
        //绑定相关的事件
        $(".send").click(function () {
            alert("提醒商家发货成功");
        })
    })
</script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/model/cartModel.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/czFunction.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/plugins/jquery.easing/jquery.easing.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/plugins/sui/sui.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/pages/index.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/widget/cartPanelView.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/widget/jquery.autocomplete.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/widget/nav.js"></script>
<!--页面底部END-->
undefined

</html>